package cn.itcast.controller.stat;

import cn.itcast.controller.BaseController;
import cn.itcast.service.stat.StatService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/stat")
public class StatController extends BaseController {

    @Reference
    private StatService statService;

    @RequestMapping(value = "/toCharts",name = "进入到统计页面")
    public String toCharts(String chartsType){ //online  sell factory

        return "stat/stat-"+chartsType;
    }

    @RequestMapping(value = "/factoryCharts",name = "获取生产厂家销售额统计数据")
    @ResponseBody
    public List<Map> factoryCharts(){
        return statService.factoryCharts(getCompanyId());
    }
    @RequestMapping(value = "/sellCharts",name = "获取产品销售量统计数据")
    @ResponseBody
    public List<Map> sellCharts(){
        return statService.sellCharts(getCompanyId());
    }
    @RequestMapping(value = "/onlineCharts",name = "获取系统压力统计数据")
    @ResponseBody
    public List<Map> onlineCharts(){
        return statService.onlineCharts(getCompanyId());
    }
    @RequestMapping(value = "/addressCharts",name = "获取生产统计数据")
    @ResponseBody
    public List<Map> addressCharts(){
        return statService.addressCharts();
    }

}
